package Zoo;

abstract class Shape {
    public abstract double calculateArea();
}
class Circle extends Shape {
    private double radius;

    public Circle(double radius) {
        this.radius=radius;
    }

    @Override
    public double calculateArea() {
        return Math.PI*radius*radius;
    }
}
class Rectangle extends Shape {
    private double length;
    private double width;

    public Rectangle(double length,double width) {
        this.length=length;
        this.width=width;
    }

    @Override
    public double calculateArea() {
        return length*width;
    }
}
public class Area {
    public static void main(String[] args) {
        Shape[] shapes=new Shape[10];
        for(int i=0;i<shapes.length;i++) {
            if(Math.random() <0.5) {
                shapes[i]=new Circle(Math.random()*10);
            } else {
                shapes[i]=new Rectangle(Math.random()*10,Math.random()*10 );
            }
        }
        for(Shape shape:shapes) {
            if(shape!=null) {
                double area=shape.calculateArea();
                System.out.println("Area:"+area);
            }
        }
    }
}
